package com.zhouyu.service;


import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Lookup;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

/**
 * @author 周瑜
 */
//@Component
//@DependsOn("orderService")
public class UserService implements DisposableBean, UserServiceInterface<OrderService> {

	@Autowired
	private Map<String, Object> user;

	@Autowired
	private OrderService orderService;

	/**
	 * Spring 自带的依赖注入不支持简单类型
	 */
//	@Autowired
//	private Number orderService;
	public void test() {

		System.out.println(user);
	}

	public void setOrderService(OrderService orderService) {
		this.orderService = orderService;
	}

//	public void setOrderService(Number orderService) {
//		this.orderService = orderService;
//	}

	public void testApplyMergedBeanDefinitionPostProcessors() {
		System.out.println("测试在实例化后，属性赋值之前操作beanDefinition");
	}

	@Override
	public void destroy() throws Exception {
		System.out.println("userService 被销毁了...");
	}

	@Autowired
	public void testAutowired() {
		System.out.println("@Autowired 属性注入");
	}

//	@Lookup("user")
//	public User a(){
//		// 无所谓返回的是什么东西。因为这次映射的都是从Spring 中获取对象的对应的对象
//		return null;
//	}
}
